import http from '@/utils/request';

// AI聊天
export const chat = (prompt: string) => {
    return http.post('/ai/api/chat', { prompt }, {
        timeout: 30000 // 设置30秒超时
    });
};

// 生成图片描述
export const generateCaption = (imagePath: string) => {
    return http.upload('/ai/api/generate-caption', imagePath, 'image');
};

// 反馈内容验证
export const feedbackContentVerification = (imagePath: string | null, content: string, contentType: string, userId: number) => {
    if (imagePath) {
        // 如果有图片，使用upload方法
        return http.upload('/ai/api/feedbackContentVerification', imagePath, 'image', {
            content: content,
            contentType: contentType,
            userId: userId
        });
    } else {
        // 如果没有图片，使用普通POST请求
        return http.post('/ai/api/feedbackContentVerification1', {
            content: content,
            contentType: contentType,
            userId: userId
        });
    }
};

// AI推荐饮品
export const recommendDrinks = (data: any) => {
    return http.post('/ai/api/ai/recommend-drinks', data, {
        timeout: 30000 // 设置30秒超时
    });
};

// 检查违禁词
export const checkForbiddenWords = (text: string) => {
    return http.post('/ai/api/ai/check-forbidden-words', { text }, {
        timeout: 10000 // 设置10秒超时
    });
};

// 获取违禁词分类
export const getForbiddenWordCategories = () => {
    return http.get('/ai/api/ai/forbidden-word-categories', {
        timeout: 10000 // 设置10秒超时
    });
};
